<h3>Register New User</h3>

<form action="/register" method="post" class="col-lg-7">
    <div class="form-group">
        @Html.ValidationSummary(new[]{ "displayName","email","password","confirmPassword" })

        @Html.HiddenInputs(new {
            @continue = "/validation/server-razor/",
            errorView = "/validation/server-razor/register"
        })
    </div>
    <div class="form-group">
        @Html.FormInput(new { id = "displayName" }, new InputOptions {
            Label = "Name",
            Help  = "Your first and last name",
            Size  = "lg",
        })
    </div>
    <div class="form-group">
        @Html.FormInput(new { id = "email" }, new InputOptions {
            Label = "Email",
            Help  = "Email you signed up with",
            Size  = "lg",
        })
    </div>
    <div class="form-group">
        @Html.FormInput(new { id = "password", type = "password" }, new InputOptions {
            Label = "Password",
            Help  = "6 characters or more",
            Size  = "lg",
        })
    </div>
    <div class="form-group">
        @Html.FormInput(new { id = "confirmPassword", type = "password" }, new InputOptions {
            Label = "Confirm Password",
            Size  = "lg",
        })
    </div>
    <div class="form-group">
        @Html.FormInput(new {
            id   = "autoLogin",
            type = "checkbox",
            @checked = true,
        },
        new InputOptions { Label = "Auto Login" })
    </div>
    <div class="form-group">
        <button class="btn btn-lg btn-primary" type="submit">Register</button>
    </div>
</form>

<div class="form-group">
    <b>Quick Populate:</b>
    <div class="quicklist">
        <span data-click="newUser:new@user.com">new@user.com</span>
    </div>
</div>

@section scripts
{
    <script>
    $(document).bindHandlers({
        newUser: function(u) {
            var names = u.split('@@');
            $("[name=displayName]").val($.ss.toPascalCase(names[0]) + " " + $.ss.toPascalCase($.ss.splitOnFirst(names[1],'.')[0]));
            $("[name=email]").val(u);
            $("[type=password]").val('p@@55wOrd');
        }
    });
    </script>
}
